package features;

import javax.swing.JOptionPane;
import javax.swing.JTextPane;

public class Exit extends Feature{

	public Exit(JTextPane textPane){
		this.textPane = textPane;
	}
	
	Save saveObject = new Save(textPane);
	
	public void exit() {
		if (text.equals(textPane.getText())) {
			System.exit(0);
		} else {
			int option = JOptionPane.showConfirmDialog(null,
					"Do you want to save the changes?");

			if (option == 0) {
				saveObject.save_as();
				System.exit(0);
			} else if (option == 1) {
				System.exit(0);
			}
		}
	}
}
